<!DOCTYPE html>
<html lang="zh-CN">
  	<head>
	    <meta charset="utf-8">
	    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	    <meta name="viewport" content="width=device-width, initial-scale=1">
	    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<title></title>
		
		<link rel="stylesheet" href="/css/bootstrap.min.css" />
		<link rel="stylesheet" href="/css/header.css" />
		<link rel="stylesheet" href="/css/newsContent.css" />
		<link rel="stylesheet" href="/css/sweetalert.css" />
	</head>
	
	<body>
		
		<%- include header %>
		
		<div class="container">
			<div class="row">
				<div class="col-md-9">
					<div class="news-header" data-newId="<%= newsContent.id %>">
						<div class="page-header">
							<h1><%= newsContent.title %> <small><%= newsContent.smallTitle %></small></h1>
						</div>
					</div>
					
					<div id="newsContent">
						<%- newsContent.content %>	
					</div>
					
					<div class="row text-right news-footer">
						<div class="col-md-2 col-md-offset-3">
							<span><%= newsContent.name %></span> 
						</div>
						<div class="col-md-3">
							<time><%= newsContent.sendTime %></time>	
						</div>	
						<div class="col-md-4">
							<span class="span-info">点击量 <span class="badge"><%= newsContent.click %></span></span>
							<span>评论数 <span class="badge"><%= newsContent.comment %></span></span>
						</div>
					</div>
					<div class="row text-right news-footer">
						<div class="col-xs-12">
							<% if(loginbean) { %>
							<button type="button" class="btn btn-warning btn-sm" id="collect">
								<% if(userCollect) { %>
								<span class="glyphicon glyphicon-star-empty" aria-hidden="true"></span>
								<% } %>
								收藏
							</button>
							<% } %>
						</div>
					</div>
				</div>
				
				<div class="col-md-3">
					<div id="sideBar">
						<div class="panel panel-info">
						    <!-- Default panel contents -->
						    <div class="panel-heading">精选推荐</div>
								
						    <!-- List group -->
						    <div class="list-group">
						    	<% recommendNews.forEach(function(item) { %>
						    		<a href="/news?newsId=<%= item.id %>" class="list-group-item"><%= item.title %></a>
						    	<% }) %>
							</div>
						</div>
					</div>
				</div>
			</div>
			
			<div class="row" id="comment">
				<div class="col-md-9">
					<div class="page-header">
						<h2>评论</h2>
					</div>
					
					<div id="commentContent">
						<ul class="media-list CommentContent0">
							<% newsCommentMain.forEach(function(mItem) { %>
							<li class="media" data-cid = "<%= mItem.commentId %>" data-id = "<%= mItem.id %>">
							    <div class="media-left">
							      <a href="#">
							        <img class="media-object img-circle" src="<%= mItem.userPicture %>" alt="...">
							      </a>
							    </div>
							    <div class="media-body">
							        <h4 class="media-heading"><%= mItem.sendName %></h4>
							        <p><%= mItem.content %></p>
							        <p class="text-right">
							        	<time class="span-info"><%= mItem.sendTime %></time>
							        	<% if(loginbean) { %>
							        		<% if(loginbean.status == '管理员' || loginbean.status == '超级管理员') { %>
							        		<a class="adminComment" data-commentId="<%= mItem.id %>" data-mainCommentObjectId="<%= mItem.mainCommentObjectId %>" href="#" class="span-info">删除评论</a>
							        		<% } %>
							        	<a href="#" class="span-info" data-value="commentOneForm">回复</a>
							        	<% } %>
							        </p>
							    </div>
							    
							    <ul class="CommentContent1">
							    	<% newsCommentLess.forEach(function(lItem) { %>
								    	<% if(mItem.id == lItem.mainCommentObjectId) { %>
										<li class="media" data-cid = "<%= lItem.commentId %>">
										    <div class="media-left">
										      <a href="#">
										        <img class="media-object img-circle" src="<%= lItem.userPicture %>" alt="...">
										      </a>
										    </div>
										    <div class="media-body">
										        <h4 class="media-heading" data-name="<%= lItem.sendName %>"><%= lItem.sendName %>&nbsp;&nbsp;<small>回复：<%= lItem.beCommentName %></small></h4>
										        <p><%= lItem.content %></p>
										        <p class="text-right">
										        	<time class="span-info"><%= lItem.sendTime %></time>
										        	<% if(loginbean) { %>
										        		<% if(loginbean.status == '管理员' || loginbean.status == '超级管理员') { %>
										        		<a class="adminComment" data-commentId="<%= lItem.id %>" data-mainCommentObjectId="<%= lItem.mainCommentObjectId %>" href="#" class="span-info">删除评论</a>
										        		<% } %>
										        	<a href="#" class="span-info" data-value="commentSecondForm">回复</a>
										        	<% } %>
										        </p>
										    </div>
										</li>
										<% } %>
									<% }) %>
								</ul>
								
							</li>
							<% }) %>
							
						</ul>
					</div>
					
					<form id="commentForm">
						<div class="form-group">
						    <label for="commentZero">发表评论：
						    	<% if(!loginbean) { %>
						    	<br />
						    	<u>亲，<a href="#" id="linkLogin">登录</a>后才能发表评论噢~</u>
						    	<% } %>
						    </label>
						    <% if(loginbean) { %>
						    <textarea name="commentZero" class="form-control" id="commentZero" placeholder="请输入评论……" rows="5"></textarea>
							<input type="hidden" value="0" />
							<% } %>
						</div>
						<% if(loginbean) { %>
						<div class="text-right">
							  <button type="submit" class="btn btn-primary">Submit</button>
						</div>
						<% } %>
					</form>
				</div>
				
				<div class="col-md-3">
					<!--预留栏-->
				</div>
			</div>
		</div>
	
		<!-------------------            Modal start         ------------------------->
		
		<div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
			<div class="modal-dialog" role="document" aria-hidden="true">
			    <div class="modal-content">
			    	
			    	
				   
				   
				   
				    
			    </div>
			</div>
		</div>
		
		<!-------------------            Modal end         ------------------------->
		
		<script type="text/javascript" src="/js/jquery-3.1.1.min.js" ></script>
		<script type="text/javascript" src="/js/bootstrap.min.js" ></script>
		<script src="/js/header.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/sweetalert.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/newsContent.js" type="text/javascript" charset="utf-8"></script>
		
	</body>
</html>
